package chaoyue.study.fallback;

import chaoyue.study.bean.Depart;
import chaoyue.study.client.FeignDepartClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 对feign客户端配置降级方法
 */
@Slf4j
@Component
public class FeignDepartControllerFallback implements FeignDepartClient {
    @Override
    public void save(Depart depart) {
        log.info("方法降级");
    }

    @Override
    public void delete(Integer id) {
        log.info("方法降级");
    }

    @Override
    public void update(Depart depart) {
        log.info("方法降级");
    }

    @Override
    public Depart get(Integer id) {
        return new Depart(id, "方法降级");
    }

    @Override
    public List<Depart> list() {
        List<Depart> resultList = new ArrayList<>();
        resultList.add(new Depart(-1, "方法降级"));
        return resultList;
    }
}
